#ifndef CHAINSAW_COMMON_READWRITEFILE_H
#define CHAINSAW_COMMON_READWRITEFILE_H

#include <string>
#include <vector>
#include <filesystem>
#include <fstream>

namespace chainsaw
{
    bool is_exists(std::string const &name);
    bool is_file(std::string const &file_name);
    bool is_path(std::string const &path_name);

    std::vector<std::string> read_file(std::string const & file_name, bool keep_empty_lines);

    enum class WriteMode
    {
        CreateNew,
        Overwrite,
        Append
    };

    class write_file
    {
    public:
        write_file(std::string const & file, WriteMode mode = WriteMode::Overwrite);

        void write(std::string const & data,bool line = true);

        void write(std::vector<std::string> data);

        ~write_file();
   
    private:
        std::fstream m_stream;
    };

} // namespace chainsaw

#endif // !CHAINSAW_COMMON_READWRITEFILE_H
